/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author ...
* @date 2020-11-08
**/
@Entity
@Data
@Table(name="shuyi_book_location")
public class BookLocation implements Serializable {

    private static final long serialVersionUID = -6087070648424846718L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "图书地址编号，自增长")
    private Integer id;

    @Column(name = "library_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "图书馆编号")
    private Integer libraryId;

    @Column(name = "isbn",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "isbn")
    private String isbn;

    @Column(name = "barcode",unique = true,nullable = false)
    @NotBlank
    @ApiModelProperty(value = "条码")
    private String barcode;

    @Column(name = "library_location")
    @ApiModelProperty(value = "图书馆位置")
    private String libraryLocation;

    @Column(name = "book_location")
    @ApiModelProperty(value = "书本在图书馆的位置")
    private String bookLocation;

    @Column(name = "is_enable",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否启用 1启用 0未启用")
    private Boolean isEnable;

    public void copy(BookLocation source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}